package com.tsingtao.springcloudproject2.service.impl;

import com.tsingtao.springcloudproject2.entity.Project2;
import com.tsingtao.springcloudproject2.mapper.Project2Mapper;
import com.tsingtao.springcloudproject2.service.TestSeataService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TestSeataServiceImpl implements TestSeataService {

    @Autowired
    private Project2Mapper project2Mapper;


    @Override
    @GlobalTransactional(rollbackFor = Exception.class)
    @Transactional(propagation = Propagation.REQUIRED)
    public int insert(Project2 project2) {
        return project2Mapper.insert(project2);
    }
}
